var s_HelloWorld = "res/MessageBox/start_logo.png";
var s_CloseNormal = "res/CloseNormal.png";
var s_CloseSelected = "res/CloseSelected.png";
/**
 * Created by KhoaNam on 7/8/2014.
 */

var WAITTING_OWNER_START = "ルームオーナーがゲームを開始するまで お待ちください。";
var WAITING_MORE_PLAYERS = "他のプレイヤーの参加を待ってます。";
var WAITING_OTHERS_READY = "Waitting others user ready";

var PLAYERINFO = {
    DEFAULT_PROFILE : "res/profiles/profile_man.png",
    NAME_FONT: "Arial",
    NAME_SIZE: 18,
    DIRECTION_ICON_EAST: "res/direction/east.png",
    DIRECTION_ICON_WEST: "res/direction/west.png",
    DIRECTION_ICON_SOUTH: "res/direction/south.png",
    DIRECTION_ICON_NORTH: "res/direction/north.png",
    OWNER_POSITION:1
};

var TILE = {
    WALL_BOT_HEIGHT: 48,
    WALL_BOT_WIDTH: 30,
    WALL_LEFT_WIDTH: 44,
    WALL_LEFT_HEIGHT: 38,
    DISTANCE: 1,
    DISTANCE_INFO:3,
    DISTANCE_OTHER_AREA: 12,
    DISTANCE_OTHER_WALL: 3,
    DISTANCE_OTHER_DIRECTION_WALL: 7,
    DISTANCE_WITH_NEW_THROWN_TILE: 5,
    DISTANCE_TILE_PICK: 15,
    BOT_WIDTH: 40,
    BOT_HEIGHT: 64,
    LEFT_WIDTH: 50,
    LEFT_HEIGHT: 26,
    TOP_HEIGHT: 48,
    TOP_WIDTH: 30,
    OVERPLAY: 15,
    OVERPLAY_LEFT_RIGHT: 25,
    ORDER_ACTION: 99,
    MAX_TILE_PER_PLAYER: 14,
    NUM_OF_ROW_THROWN_TILE: 6,
    THROWN_TILE_HEIGHT: {
        1: 48,
        2: 38,
        3: 48,
        4: 38
    },

    THROWN_TILE_WIDTH: {
        1: 30,
        2: 44,
        3: 30,
        4: 44
    },

    ORDER_ANIMATION: 300,
    ORDER_PICKED: 100,
    ORDER_WALL: 150,
    ORDER_PICKED_BOT: 200,
    ORDER_MESSAGE_DIALOG: 500,
    ORDER_THROWN_TILE: {
        1: 32,
        2: 31,
        3: 31,
        4: 20
    },
    TIME_THROWN_TILE: 0.3,
    TIME_SORT_THROWN_TILE: 0.1

};

var GAME = {
    BACKGROUND : "res/imgBgTransparent.png",
    INFOBACKGROUND: "res/InforUser.png",
    HEIGHT: 640,
    WIDTH:800,
    NUM_OF_PLAYER: 4,
    MAX_PLAYER: 4
};

var MESSAGEBOX = {
    BACKGROUND: "res/MessageBox/popup_base.png",
    START_LOGO: "res/MessageBox/start_logo.png",
    FONT: "Verdana",
    FONT_SIZE: 20,
    PADDING: 10,
    BUTTON_START: 1,
    BUTTON_READY: 0,
    BUTTON_QUIT: 2
};

var INFO = {
    PLAYER: PLAYERINFO,
    GAME: GAME,
    MESSAGEBOX: MESSAGEBOX,
    BUTTON:{
        READY:{
            NORMAL: "res/MessageBox/ready.png",
            DOWN: "res/MessageBox/ready_pushed.png"
        },
        START:{
            NORMAL: "res/MessageBox/start.png",
            DOWN: "res/MessageBox/start_pushed.png"
        },

        RIICHI: {
            NORMAL:"res/button/riichi.png",
            DOWN: "res/button/riichi_pushed.png"
        },

        TSUMO: {
            NORMAL: "res/button/tsumo.png",
            DOWN: "res/button/tsumo_pushed.png"
        },

        RON: {
            NORMAL: "res/button/ron.png",
            DOWN: "res/button/ron_pushed.png"
        },

        OK: {
            NORMAL: "res/button/ok.png",
            DOWN: "res/button/ok_pushed.png"
        },

        REPLAY:{
            NORMAL: "res/button/replay.png",
            DOWN: "res/button/replay_pushed.png"
        },

        JOIN_ROOM_REPLAY:{
            NORMAL: "res/button/joinreplayroom.png",
            DOWN: "res/button/joinreplayroom_pushed.png"
        }
    },
    TILE: TILE,
    ANIMATION:{
        DELAY_TILE:0.5,
        SPEED: 1500
    },
    TEXT: {
        DIRECTION:{
            "1": "東",
            "2": "南",
            "3": "西",
            "4": "北"
        },
        CHI: "CHI",
        PON: "PON",
        KAN: "KAN",
        RIICHI: "RIICHI",
        TSUMO: "TSUMO",
        RON: "RON"
    },
    TYPE_WIN_TILE:{
        TSUMO: 1,
        RIICHI: 2,
        RON: 3,
        OPENKAN: 4,
        CLOSEKAN: 5,
        LATEKAN: 6,
        PON: 7,
        CHI: 8
    },

    ICONS: {
        WIN: "res/icons/win.png",
        LOSE: "res/icons/lose.png",
        BAR: "res/bar/bar.png"
    },

    DICE: {
        PLIST: "res/dice/dice.plist"
    }
};

// load resource

var g_resources = [
    //image
    s_HelloWorld,
    s_CloseNormal,
    s_CloseSelected,
    GAME.BACKGROUND,
    GAME.INFOBACKGROUND,
    PLAYERINFO.DEFAULT_PROFILE,
    PLAYERINFO.DIRECTION_ICON_EAST,
    PLAYERINFO.DIRECTION_ICON_NORTH,
    PLAYERINFO.DIRECTION_ICON_SOUTH,
    PLAYERINFO.DIRECTION_ICON_WEST,
    MESSAGEBOX.BACKGROUND,
    MESSAGEBOX.START_LOGO,

    INFO.BUTTON.READY.NORMAL,
    INFO.BUTTON.READY.DOWN,
    INFO.BUTTON.START.NORMAL,
    INFO.BUTTON.START.DOWN,
    //icons
    INFO.ICONS.WIN,
    INFO.ICONS.LOSE,
    INFO.ICONS.BAR,

    INFO.BUTTON.RIICHI.NORMAL,
    INFO.BUTTON.RIICHI.DOWN,
    INFO.BUTTON.RON.NORMAL,
    INFO.BUTTON.RON.DOWN,
    INFO.BUTTON.TSUMO.NORMAL,
    INFO.BUTTON.TSUMO.DOWN,
    INFO.BUTTON.OK.NORMAL,
    INFO.BUTTON.OK.DOWN,
    INFO.BUTTON.REPLAY.NORMAL,
    INFO.BUTTON.REPLAY.DOWN,
    INFO.BUTTON.JOIN_ROOM_REPLAY.NORMAL,
    INFO.BUTTON.JOIN_ROOM_REPLAY.DOWN,

    //plist
    INFO.DICE.PLIST,
    "res/dice/sprite1.png",
    "res/dice/dice.png",
    //fnt

    //tmx

    //bgm

    //effect
    "res/sound/user_play.mp3",
    "res/sound/chi.mp3"

];

for (var i = 0; i <= 35; i++) {
    g_resources.push("res/up_0/" + i + ".png");
};

for (var i = 0; i <= 35; i++) {
    g_resources.push("res/up_1/" + i + ".png");
};

for (var i = 0; i <= 35; i++) {
    g_resources.push("res/up_2/" + i + ".png");
};

for (var i = 0; i <= 35; i++) {
    g_resources.push("res/up_3/" + i + ".png");
};

for (var i = 0; i <= 33; i++) {
    g_resources.push("res/up_front/" + i + ".png");
};

//

for (var i = 0; i <= 34; i++) {
    g_resources.push("res/front/" + i + ".png");
};

g_resources.push("res/left/34.png");
g_resources.push("res/right/34.png");
g_resources.push("res/back/34.png");

//add dice
for (var i = 1; i <= 6; i++) {
    g_resources.push("res/dice/" + i + ".png");
    g_resources.push("res/dice/dice" + i + ".png");
};

g_resources.push("res/button/skip.png");
g_resources.push("res/button/skip_pushed.png");


